package com.lzg.extend;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

/**
 * 注：@SerializedName只在gson解析时使用，
 *     Jackson解析中无效。
 */
public class BaseResponse<T> implements Serializable {

    private static final long serialVersionUID = 5213230387175987834L;

    @SerializedName(value = "code", alternate = {"msgcode", "msgCode", "ret"})
    private int code;
    @SerializedName(value = "msg", alternate = {"info"})
    private String msg;
    @SerializedName(value = "data", alternate = {"object"})
    private T data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "BaseResponse{\n"
                + "\tcode=" + code + "\n"
                + "\tmsg='" + msg + "\'\n"
                + "\tdata=" + data + "\n" + '}';
    }

}
